home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / a_utils / perl / cterm.lha / cursesXt.c < prev    next >
C/C++ Source or Header  |  1993-08-13  |  3KB  |  134 lines

  1. #include <stdio.h>
  2. #include <curses.h>
  3. #include "cursesXt.h"
  4. #include "defs.h"
  5.  
  6. void initCursesXt()
  7. { /* called by do_initscr ; */
  8.   ;
  9. }
  10.  
  11. int getLINES() { return(LINES) ; }
  12. int getCOLS()  { return(COLS) ; }
  13.  
  14. int wgetchR(w)
  15. WINDOW *w ;
  16. { int x,y,c ;
  17.   for ( c = wgetch(w)
  18.       ; ( c == REDRAW_INT ) || ( optX && ( c == OPTX_INT ) )
  19.       ; c = wgetch(w)
  20.       )
  21.     { if ( c == REDRAW_INT )
  22.     { getyx(w,y,x) ;
  23.       redraw() ;
  24.           wmove(w,y,x) ;
  25.       wrefresh(w) ;
  26.     }
  27.       else if ( c == OPTX_INT )
  28.     { curStat() ; }
  29.     }
  30.   return(c) ;
  31. }
  32.  
  33. int getchR()
  34. { return(wgetchR(stdscr)) ; }
  35.  
  36. void quitcterm()
  37. { quit() ;
  38. }
  39.  
  40. void wshow (win,line,cp,ystart,xstart,xlen,rep)
  41. WINDOW *win ;
  42. char *line ;
  43. int cp, ystart,xstart,xlen ;
  44. char *rep ;
  45. { showline(line,cp,win,ystart,xstart,xlen,rep) ;
  46. }
  47.  
  48. void show (line,cp,ystart,xstart,xlen,rep)
  49. char *line ;
  50. int cp, ystart,xstart,xlen ;
  51. char *rep ;
  52. { showline(line,cp,stdscr,ystart,xstart,xlen,rep) ;
  53. }
  54.  
  55. int wedit (win,line,curpos,ystart,xstart,xlen,rep)
  56. WINDOW *win ;
  57. char *line ;
  58. int curpos, ystart, xstart, xlen ;
  59. char *rep ;
  60. { int c ;
  61.   c = editline (line,BUFSIZE,&curpos,win,ystart,xstart,xlen,rep) ;
  62.   addlogsn(LOGCURS2,"wedit returns",c) ;
  63.   return( c ) ;
  64. }
  65.  
  66. int edit (line,curpos,ystart,xstart,xlen,rep)
  67. char *line ;
  68. int curpos, ystart, xstart, xlen ;
  69. char *rep ;
  70. { int c ;
  71.   c = editline (line,BUFSIZE,&curpos,stdscr,ystart,xstart,xlen,rep) ;
  72.   addlogsn(LOGCURS2,"edit returns",c) ;
  73.   return( c ) ;
  74. }
  75.  
  76. void mybeep() { fprintf(stderr,"%c",7) ; }
  77. void nobeep() { ; }
  78.  
  79. void wclrreg(w,top,bot)
  80. WINDOW *w ;
  81. int top,bot ;
  82. { int i ;
  83.   for ( i = top ; i <= bot ; i++ )
  84.     { wmove(w,i,0) ;
  85.       wclrtoeol(w) ;
  86.     }
  87. }
  88.  
  89. void clrreg(top,bot)
  90. int top,bot ;
  91. { wclrreg(stdscr,top,bot) ; }
  92.  
  93. void ctermlog(s) char *s ; { addlogss(LOGAPPL,"LOG",s) ; }
  94.  
  95. int editq(n)      int n ;   { return(addQuitEdit(n)) ; }
  96. void editreset()            { emptyQuitEdit() ; }
  97. int editl(n)      int n ;   { return(addLeftEdit(n)) ; }
  98. void editlreset()           { emptyLeftEdit() ; }
  99. int editr(n)      int n ;   { return(addRightEdit(n)) ; }
  100. void editrreset()           { emptyRightEdit() ; }
  101. void curnop()               { ; }
  102. void curflush()             { ; }
  103.  
  104. /*
  105. Example implementations of killchar() ; erasechar() ; beep() ;
  106. Quite non-portable; just to show that it should be simple.
  107.  
  108. #include <termio.h>
  109.  
  110. killchar()
  111. { struct termio ttt ;
  112.   ioctl(0,TCGETA,&ttt) ;
  113.   return(ttt.c_cc[VKILL]) ;
  114. }
  115.  
  116. erasechar()
  117. { struct termio ttt ;
  118.   ioctl(0,TCGETA,&ttt) ;
  119.   return(ttt.c_cc[VERASE]) ;
  120. }
  121.  
  122. beep()
  123. { BEEP() ;
  124. }
  125.  
  126. */
  127.  
  128. /* On a Convex, add the following lines for compatibility.
  129.  
  130. cbreak() { crmode() ; }
  131. nocbreak() { nocrmode() ; }
  132.  
  133. */
  134.